﻿<UserControl xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"  x:Class="Moonwish.Foundation.Views.ValueObjects.ValueObjectMainView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
             xmlns:custom="clr-namespace:Moonwish.Silverlight.Core;assembly=Moonwish.Silverlight.Core"
             
             xmlns:v="clr-namespace:Moonwish.Foundation.Views.ValueObject"
             xmlns:vm="clr-namespace:Moonwish.Foundation.ViewModels.ValueObject"
             xmlns:ValueObjects="clr-namespace:Moonwish.Foundation.ViewModels.ValueObjects"
             xmlns:ValueObjects1="clr-namespace:Moonwish.Foundation.Views.ValueObjects" mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">
    <UserControl.DataContext>
        <ValueObjects:ValueObjectMainViewModel />
    </UserControl.DataContext>
    <i:Interaction.Triggers>
        <i:EventTrigger EventName="Loaded">
            <custom:EventToCommandTrigger Command="{Binding InitializationCommand}"/>
        </i:EventTrigger>
    </i:Interaction.Triggers>
    <Grid x:Name="LayoutRoot">
        <Grid Margin="6">
                <Grid.RowDefinitions>
                    <RowDefinition Height="250"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="30"></RowDefinition>
                        <RowDefinition Height="30"></RowDefinition>
                        <RowDefinition Height="*"></RowDefinition>
                    </Grid.RowDefinitions>
                    <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Height="30">
                    <Button x:Name="BtnAddClass" Content="新增" 
                            Command="{Binding ValueObjectClassViewModel.AddCommand}" Style="{StaticResource ButtonStyle}"></Button>
                    <Button x:Name="BtnPublishClass" Content="发布" 
                            IsEnabled="{Binding ValueObjectClassViewModel.CanPublish}" 
                            Command="{Binding ValueObjectClassViewModel.PublishCommand}"
                            CommandParameter="{Binding ValueObjectClassViewModel.SelectedItem}"
                            Style="{StaticResource ButtonStyle}" Margin="10,0, 0, 0"></Button>
                    <Button x:Name="BtnDisableClass" Content="作废" 
                            IsEnabled="{Binding ValueObjectClassViewModel.CanDisable}" 
                            Command="{Binding ValueObjectClassViewModel.DisableCommand}"
                            CommandParameter="{Binding ValueObjectClassViewModel.SelectedItem}"
                            Style="{StaticResource ButtonStyle}" Margin="10,0, 0, 0"></Button>
                    <Button x:Name="BtnDelClass" Content="删除" 
                            IsEnabled="{Binding ValueObjectClassViewModel.CanDelete}" 
                            Command="{Binding ValueObjectClassViewModel.DeleteCommand}"
                            CommandParameter="{Binding ValueObjectClassViewModel.SelectedItem}"
                            Style="{StaticResource ButtonStyle}" Margin="10,0, 0, 0"></Button>
                    </StackPanel>
                    <Grid Grid.Row="1" VerticalAlignment="Bottom" Margin="0, 5,0, 0">
                        <Rectangle Fill="LightGray" />
                        <TextBlock x:Name="ClassTitle" HorizontalAlignment="Left" Margin="8,0,0,0" TextWrapping="Wrap" Text="值对象分类" d:LayoutOverrides="Height" FontSize="14" Foreground="#FF898989" VerticalAlignment="Center"/>
                    </Grid>
                    <ValueObjects1:ValueObjectClassView x:Name="ValueObjectClassView1" Grid.Row="2" Margin="0, 1,0, 0"/>
                </Grid>
            <Grid Grid.Row="1">
                <Grid.RowDefinitions>
                    <RowDefinition Height="30"></RowDefinition>
                    <RowDefinition Height="30"></RowDefinition>
                    <RowDefinition Height="*"></RowDefinition>
                </Grid.RowDefinitions>
                    <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Height="30">
                        <Button x:Name="BtnAddOv" Content="新增" 
                                Command="{Binding ValueObjectViewModel.AddCommand}"
                                IsEnabled="{Binding ValueObjectViewModel.CanAdd}"
                                Style="{StaticResource ButtonStyle}"></Button>
                    <Button x:Name="BtnPublishOv" Content="发布" 
                            Command="{Binding ValueObjectViewModel.PublishCommand}" 
                            CommandParameter="{Binding ValueObjectViewModel.SelectedItem}"
                            IsEnabled="{Binding ValueObjectViewModel.CanPublish}"
                            Style="{StaticResource ButtonStyle}" Margin="10,0, 0, 0"></Button>
                    <Button x:Name="BtnDisableOv" Content="作废" 
                            Command="{Binding ValueObjectViewModel.DisableCommand}"
                            CommandParameter="{Binding ValueObjectViewModel.SelectedItem}"
                            IsEnabled="{Binding ValueObjectViewModel.CanDisable}"
                            Style="{StaticResource ButtonStyle}" Margin="10,0, 0, 0"></Button>
                    <Button x:Name="BtnDelOv" Content="删除" 
                            Command="{Binding ValueObjectViewModel.DeleteCommand}"
                            CommandParameter="{Binding ValueObjectViewModel.SelectedItem}"
                            IsEnabled="{Binding ValueObjectViewModel.CanDelete}"
                            Style="{StaticResource ButtonStyle}" Margin="10,0, 0, 0"></Button>
                    </StackPanel>
                    <Grid Grid.Row="1" VerticalAlignment="Bottom" Margin="0, 5,0, 0">
                        <Rectangle Fill="LightGray" />
                        <TextBlock x:Name="OvTitle" HorizontalAlignment="Left" Margin="8,0,0,0" TextWrapping="Wrap" Text="值对象" d:LayoutOverrides="Height" FontSize="14" Foreground="#FF898989" VerticalAlignment="Center"/>
                    </Grid>
                    <ValueObjects1:ValueObjectView Grid.Row="2" Margin="0, 1,0, 0"/>
            </Grid>
            </Grid>
        <toolkit:BusyIndicator IsBusy="{Binding IsBusy}" />
    </Grid>
</UserControl>
